home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / circuits / pcb-1.000 / pcb-1 / pcb-1.3 / mirror.c < prev    next >
C/C++ Source or Header  |  1995-02-27  |  3KB  |  93 lines

  1. /*
  2.  *                            COPYRIGHT
  3.  *
  4.  *  PCB, interactive printed circuit board design
  5.  *  Copyright (C) 1994,1995 Thomas Nau
  6.  *
  7.  *  This program is free software; you can redistribute it and/or modify
  8.  *  it under the terms of the GNU General Public License as published by
  9.  *  the Free Software Foundation; either version 2 of the License, or
  10.  *  (at your option) any later version.
  11.  *
  12.  *  This program is distributed in the hope that it will be useful,
  13.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  *  GNU General Public License for more details.
  16.  *
  17.  *  You should have received a copy of the GNU General Public License
  18.  *  along with this program; if not, write to the Free Software
  19.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  *
  21.  *  Contact addresses for paper mail and Email:
  22.  *  Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
  23.  *  Thomas.Nau@rz.uni-ulm.de
  24.  *
  25.  */
  26.  
  27. static    char    *rcsid = "$Header$";
  28.  
  29. /* functions used to change the mirror flag of an object
  30.  */
  31.  
  32. #include <stdlib.h>
  33.  
  34. #include "global.h"
  35.  
  36. #include "data.h"
  37. #include "draw.h"
  38. #include "mirror.h"
  39. #include "search.h"
  40. #include "select.h"
  41. #include "set.h"
  42.  
  43. /* ---------------------------------------------------------------------------
  44.  * some local prototypes
  45.  */
  46. static    void    *MirrorText(LayerTypePtr, TextTypePtr);
  47. static    void    *MirrorElementName(ElementTypePtr);
  48.  
  49. /* ---------------------------------------------------------------------------
  50.  * some local identifiers
  51.  */
  52. static    ObjectFunctionType    MirrorFunctions = {
  53.     NULL,
  54.     MirrorText,
  55.     NULL,
  56.     NULL,
  57.     NULL,
  58.     MirrorElementName,
  59.     NULL,
  60.     NULL };
  61.  
  62. /* ---------------------------------------------------------------------------
  63.  * changes the mirror flag of a text object
  64.  */
  65. static void *MirrorText(LayerTypePtr Layer, TextTypePtr Text)
  66. {
  67.     EraseText(Text);
  68.     MIRROR(Text);
  69.     DrawText(Layer, Text);
  70.     return(Text);
  71. }
  72.  
  73. /* ---------------------------------------------------------------------------
  74.  * changes the mirror flag of a text object
  75.  */
  76. static void *MirrorElementName(ElementTypePtr Element)
  77. {
  78.     EraseElementName(Element);
  79.     MIRROR(&CANONICAL_TEXT(Element));
  80.     MIRROR(&NAMEONPCB_TEXT(Element));
  81.     DrawElementName(Element);
  82.     return(Element);
  83. }
  84.  
  85. /* ---------------------------------------------------------------------------
  86.  * changes the objects mirror flag of the one at the current cursor location.
  87.  * The passed ID can match more than one type but only one object is changed
  88.  */
  89. void MirrorObject(int Type, void *Ptr1, void *Ptr2)
  90. {
  91.     ObjectOperation(&MirrorFunctions, Type, Ptr1, Ptr2);
  92. }
  93.